import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import autoprefixer from 'autoprefixer';
import postCssPxToRem from 'postcss-pxtorem';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  server: {
    // host: '192.168.1.106'
  },
  base: './',
  build: {
    assetsPublicPath: './'
  },
  css: {
    postcss: {
      plugins: [
        autoprefixer({
          overrideBrowserslist: ['Android 4.1', 'iOS 7.1', 'Chrome > 31', 'ff > 31', 'ie >= 8'],
        }),
        postCssPxToRem({
          // %E8%87%AA%E9%80%82%E5%BA%94%EF%BC%8Cpx>rem%E8%BD%AC%E6%8D%A2          
          rootValue: 75,
          // 75%E8%A1%A8%E7%A4%BA750%E8%AE%BE%E8%AE%A1%E7%A8%BF%EF%BC%8C37.5%E8%A1%A8%E7%A4%BA375%E8%AE%BE%E8%AE%A1%E7%A8%BF
          propList: ['*'],
          // %E9%9C%80%E8%A6%81%E8%BD%AC%E6%8D%A2%E7%9A%84%E5%B1%9E%E6%80%A7%EF%BC%8C%E8%BF%99%E9%87%8C%E9%80%89%E6%8B%A9%E5%85%A8%E9%83%A8%E9%83%BD%E8%BF%9B%E8%A1%8C%E8%BD%AC%E6%8D%A2          
          selectorBlackList: ['norem'],
          // %E8%BF%87%E6%BB%A4%E6%8E%89norem-%E5%BC%80%E5%A4%B4%E7%9A%84class%EF%BC%8C%E4%B8%8D%E8%BF%9B%E8%A1%8Crem%E8%BD%AC%E6%8D%A2        
        }),
      ],
    },
  }
})
